package com.kk.aop;


import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Component
@Aspect
public class AfterAop {
    @Pointcut("@annotation(com.kk.aop.log)")
    void after(){
    }


    //@After("execution(* com.kk.service.impl.DeptLogServiceImp.*(..))")
    @After("after()")
    public void getAfterAop(JoinPoint joinPoint){
        Object[] args = joinPoint.getArgs();
        String ClassName = joinPoint.getTarget().getClass().getName();
        String methodName = joinPoint.getSignature().getName();
        String string = Arrays.toString(args);
        System.out.println("after方法执行了"+"类"+ClassName+"方法:"+methodName+"参数:"+ string);
    }
}
